package com.study.async.demo.config;

import com.study.async.demo.interceptor.MyAsyncHandlerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author wuxj
 * @date 2017/8/16
 */

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    /**
     * spring 拦截器
     *
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // addPathPatterns 用于添加拦截 excludePathPatterns 用户排除拦截
        registry.addInterceptor(new MyAsyncHandlerInterceptor()).addPathPatterns("/**");
    }
}

